package com.geek.javase.ch06.test2;

/*
 *@author wangpeng
 *2025/10/14 23:29
 *@description TODO
 */

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 1."2014-5-25"到"2012-12-28"中间有多少天？
 */
public class Demo1 {
    public static void main(String[] args) throws ParseException {
        String dateStr1 = "2014-5-25";
        String dateStr2 = "2012-12-28";

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

        Date date1 = simpleDateFormat.parse(dateStr1);
        Date date2 = simpleDateFormat.parse(dateStr2);
        long time1 = date1.getTime();
        long time2 = date2.getTime();
        long day = (time1 - time2) / (1000 * 60 * 60 * 24);
        System.out.println(day);
    }

}
